<?php

use yii\helpers\Html;
use yii\grid\GridView;
use yii\widgets\LinkPager;

/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'Orders';
$this->params['breadcrumbs'][] = $this->title;
$this->registerJs('InitiateSimpleDataTable.init();');
$this->registerCssFile('/css/purebox-metro.css');
$this->registerJsFile('/layer/layer.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerCssFile("/bsadmin/assets/css/dataTables.bootstrap.css");
$this->registerJsFile('http://code.jquery.com/jquery-migrate-1.1.1.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/js/bootstrap-affix.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/js/jquery.purebox.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/datatable/jquery.dataTables.min.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/datatable/ZeroClipboard.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/datatable/dataTables.tableTools.min.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/datatable/dataTables.bootstrap.min.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/datatable/datatables-init.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/js/order.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);
$this->registerJsFile('/bsadmin/assets/js/select2/select2.js',[ 'depends' => 'backend\assets\AppAsset','position'=> yii\web\View::POS_END]);

?>
                <!-- Page Body -->
                <div class="page-body">
                    <div class="row">
                        <div class="col-xs-12 col-md-12">
                            <div class="widget">
                                <div class="widget-header ">
                                    <span class="widget-caption">Simple DataTable</span>
                                    <div class="widget-buttons">
                                        <a href="#" data-toggle="maximize">
                                            <i class="fa fa-expand"></i>
                                        </a>
                                        <a href="#" data-toggle="collapse">
                                            <i class="fa fa-minus"></i>
                                        </a>
                                        <a href="#" data-toggle="dispose">
                                            <i class="fa fa-times"></i>
                                        </a>
                                    </div>
                                </div>
                                <div class="widget-body">
                                    <table class="table table-striped table-bordered table-hover" id="simpledatatable">
                                        <thead>
                                            <tr>
                                                <th>
                                                    <div class="checker"><span class=""><input type="checkbox" class="group-checkable" data-set="#flip .checkboxes"></span></div>
                                                </th>
                                                <th> 订单编号</th>
                                                 <th>会员名</th>
                                                 <th>总金额</th>
                                                <th> 订单状态</th>
                                                <th>收件人</th>
                                                <th>手机</th>
                                                <th>电话</th>
                                                <th>操作</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                        <?php foreach($data as $val):?>
                                            <tr>
                                                <td>
                                                    <div class="checker"><span class=""><input type="checkbox" class="checkboxes" value="1"></span></div>
                                                </td>
                                                <td>
                                                    <?=$val->omun?>
                                                </td>
                                                <td>
                                                    <?=$val->user->username?>
                                                </td>
                                                <td>
                                                <?=$val->price?>
                                                </td>
                                                <td>
                                                <?php switch ($val->status){
                                                    case 0:echo '未付款';break;
                                                    case 1:echo '已付款';break;
                                                    case 2:echo '已发货';break;
                                                    case 3:echo '已收货';break;
                                                }?>
                                                </td>
                                                <td>
                                                <?=$val->name?>
                                                </td>
                                                <td>
                                                <?=$val->tel?>
                                                </td>
                                                <td>
                                                <?=$val->phone?>
                                                </td>
                                                <td>
                                                <a href="/order/view?id=<?=$val->id?>" class="btn btn-info btn-xs">查看详情</a> <?php if($val->status>0 && $val->status<3):?><a href="#" class="btn btn-info btn-xs fahuo" data-id="<?=$val->id?>">发货</a><?php endif;?> <a href="/order/update?id=<?=$val->id?>" class="btn btn-info btn-xs edit">编辑</a>
                                                </td>
                                            </tr>
                                         <?php endforeach;?>
                                        </tbody>
                                    </table>
                                <?= LinkPager::widget([ 
    'pagination' => $pages, 
	'firstPageLabel' => '首页',
	'lastPageLabel' => '尾页',
    'nextPageLabel' => '下一页', 
    'prevPageLabel' => '上一页',
    'maxButtonCount'=>4
]); ?>
                                </div>
                            </div>
                        </div>
                    </div>
                    </div>